class CreateSalesFollowUps < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_follow_ups do |t|
      t.integer :firm_id, comment: '相关公司'
      t.integer :contact_id, comment: '相关联系人'
      t.integer :leads_type, comment: '跟进方式'
      t.integer :follow_up_type, comment: '电话/见面跟进'
      t.datetime :appointment_time, comment: '安排时间'
      t.datetime :completed_at, comment: '完成时间'
      t.string :content, comment: '跟进详情'
      t.integer :user_id, comment: '跟进人'
      t.integer :created_by, comment: '创建人'
      t.integer :completed_by, comment: '完成人'
      t.integer :follow_up_target_type, comment: '跟进目标'

      t.timestamps
    end
    add_index :sales_follow_ups, :firm_id
    add_index :sales_follow_ups, :contact_id
    add_index :sales_follow_ups, :leads_type
    add_index :sales_follow_ups, :follow_up_type
    add_index :sales_follow_ups, :appointment_time
    add_index :sales_follow_ups, :completed_at
    add_index :sales_follow_ups, :user_id
    add_index :sales_follow_ups, :created_at
  end
end
